package com.googlecode.cswish.view;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.opensymphony.xwork2.util.ValueStack;

/**
 * @see org.apache.struts2.views.freemarker.tags.StrutsModels
 * @author Jerry.feng Date: 2008-5-30
 */
public class ExStrutsModels {
	
	protected ValueStack stack;
    protected HttpServletRequest req;
    protected HttpServletResponse res;
	
	protected DataGridModel dataGrid;
	protected ModelSelectModel modelSelectModel;
	protected PageInfoTagModel pageInfoTag;
	
	// OO page tag
	protected ExtendsModel extendsModel;
	protected MarkModel markModel;
	protected CallModel callModel;
	protected IncludeModel includeModel;

	public ExStrutsModels(ValueStack stack, HttpServletRequest req, HttpServletResponse res) {
		this.stack = stack;
        this.req = req;
        this.res = res;
	}

	public MarkModel getMark() {
		if (markModel == null) {
			markModel = new MarkModel(stack, req, res);
		}

		return markModel;
	}

	public ExtendsModel getExtends() {
		if (extendsModel == null) {
			extendsModel = new ExtendsModel(stack, req, res);
		}

		return extendsModel;
	}

	public CallModel getCall() {
		if (callModel == null) {
			callModel = new CallModel(stack, req, res);
		}

		return callModel;
	}

	public DataGridModel getDataGrid() {
		if (dataGrid == null) {
			dataGrid = new DataGridModel(stack, req, res);
		}
		return dataGrid;
	}
	
	public ModelSelectModel getModelSelect() {
		if (modelSelectModel == null) {
			modelSelectModel = new ModelSelectModel(stack, req, res);
		}
		return modelSelectModel;
	}

	public PageInfoTagModel getPageInfoTag() {
		if (pageInfoTag == null) {
			pageInfoTag = new PageInfoTagModel(stack, req, res);
		}
		return pageInfoTag;
	}
	
	public IncludeModel getInclude() {
		if (includeModel == null) {
			includeModel = new IncludeModel(stack, req, res);
		}
		return includeModel;
	}
}